package com.example.demo.model;/*
 * Copyright © 2020-2035 erupt.xyz All rights reserved.
 * Author: YuePeng (erupts@126.com)
 */

import javax.persistence.*;
import xyz.erupt.annotation.*;
import xyz.erupt.annotation.sub_erupt.*;
import xyz.erupt.annotation.sub_field.*;
import xyz.erupt.annotation.sub_field.sub_edit.*;
import xyz.erupt.upms.model.base.HyperModel;
import xyz.erupt.jpa.model.BaseModel;
import java.util.Set;
import java.util.Date;

@Erupt(name = "每日快讯")
@Table(name = "daily_express")
@Entity
public class DailyExpress extends BaseModel {

        @EruptField(
                views = @View(
                        title = "快讯封面"
                ),
                edit = @Edit(
                        title = "快讯封面",
                        type = EditType.ATTACHMENT, notNull = true,
                        attachmentType = @AttachmentType(type = AttachmentType.Type.IMAGE)
                )
        )
        private String express_cover;

        @EruptField(
                views = @View(
                        title = "标题"
                ),
                edit = @Edit(
                        title = "标题",
                        type = EditType.INPUT, search = @Search, notNull = true,
                        inputType = @InputType
                )
        )
        private String express_title;

        @EruptField(
                views = @View(
                        title = "快讯简介"
                ),
                edit = @Edit(
                        title = "快讯简介",
                        type = EditType.TEXTAREA, notNull = true
                )
        )
        private String express_brief;

        @EruptField(
                views = @View(
                        title = "快讯日期", sortable = true
                ),
                edit = @Edit(
                        title = "快讯日期",
                        type = EditType.DATE, search = @Search, notNull = true,
                        dateType = @DateType
                )
        )
        private Date express_date;

        @EruptField(
                views = @View(
                        title = "置顶"
                ),
                edit = @Edit(
                        title = "置顶",
                        type = EditType.BOOLEAN, search = @Search, notNull = true,
                        boolType = @BoolType
                )
        )
        private Boolean express_top;

        @EruptField(
                views = @View(title = "发布状态"),
                edit = @Edit(title = "发布状态", notNull = true, boolType = @BoolType(trueText = "发布", falseText = "草稿"), search = @Search)
        )
        private Boolean express_status;

        @EruptField(
                views = @View(
                        title = "快讯内容"
                ),
                edit = @Edit(
                        title = "快讯内容",
                        type = EditType.HTML_EDITOR, notNull = true,
                        htmlEditorType = @HtmlEditorType(HtmlEditorType.Type.UEDITOR)
                )
        )
        private @Lob String express_content;

}